<?php 
		
	include "admin/lib/config.inc.php";
		
	$username = post('usr');
	$password = post('pass');
	
	
	if ($username != null && $password != null) {
	
		// procurar no BD alguem que tenha o mesmo login e senha que foram enviados no BD....
		$password = sha1(md5($password));
		$res = mysql_query ("SELECT * FROM usuarios WHERE username = '$username' AND password = '$password'");
		$usuario = mysql_fetch_array($res);
		
		if (!$usuario){
			?>
			<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<?php
	$caminho = $_SERVER['DOCUMENT_ROOT'];
?>
	<head>
		<meta http-equiv="Content-Type" content="text/html;">
		<title>Erro 403 - Acesso Negado</title>
		<link href="lib/css/bootstrap.css" rel="stylesheet" media="screen">
		
		
	</head>
	<style type="text/css"> 
		body {
			background-color: #ffffff;	
		}
		p{
			color: #000000;
		}
		
	</style>
	<body >
<style type="text/css">
    body{ background: url(""); }
</style>

 <div class="container" >

<form method='post' action='validaLogin.php' class="col-md-offset-3 col-md-6 col-md-offset-3" style="margin-top: 15%;">
	<div class="panel panel-info">
	<div class="panel-heading"><h5>Aqui Tem - Login ou Senha Inv&aacutelidos</h5><h6>(Seu Login ou senha n&atildeo foram encontrados em nosso sistema. Tente novamente!)</h6></div>
		<div class="panel-body "><div class="col-md-offset-2 col-md-8 col-md-offset-2"><br>
			<fieldset >
				<div class="form-group">
					<div class="input-group">
		  				<span class="input-group-addon">Usu&aacuterio</span>
				      	<input type="text" name="usr" class="form-control" maxlength="15">
				    </div>
				</div>
			  	<div class="form-group">
			    	<div class="input-group">
		  				<span class="input-group-addon">Senha  :</span>
			      		<input type="password" name="pass" class="form-control" maxlength="6">
			    	</div>
			  	</div>
			  	<div class="form-group">
		    		<div class="controls">
					<button type="submit" class="btn">Entrar</button>
					</div>
				</div>
			</fieldset>
		</div>
	</div>
	</div>
	</form>
	
</div>
	
	
	<div id = "pgNotFound" align="center">
		<h2>Tente Novamente</h2>
		<p class="lead"> Oops! </p><br>
		<p>Voc&ecirc pode voltar imediatamente para a p&aacutegina inicial do nosso site clicando abaixo: </p>
		<p><a href="../admin/login.php"> www.aquitemonline.com</a></p><br>
	</div>
	</body>
</html><?php 
		 			
		}
		else {
			session_start();
			$_SESSION['usuario_login'] = $usuario;
			//echo "Login Realizado!";			
			header('Location: index.php?pg=classificados');
			
			die ();
		}
		
	}else{
		echo '<div class="panel"> <div class="panel-body"><div class="alert col-md-offset-3 col-md-6 col-md-offset-3 alert-warning">
				<button type="button" class="close" data-dismiss="alert"></button>
				<center> <strong>ATEN&Ccedil&AtildeO!</strong> Preencha os campos de login e senha para acessar o sistema.</center>
				</div></div></div>';
	}
?>